import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class ZBJS {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()) {
            final String s = scanner.nextLine();
            final String[] split = s.split(";");
            List<String> reg = new ArrayList<>(split.length);
            for (String s1 : split) {
                if (s1.matches("[ASWD]\\d{1,2}")) {
                    reg.add(s1);
                }
            }
            // 开始计算
            int x = 0;
            int y = 0;
            for (String s1 : reg) {
                char c = s1.charAt(0);
                int number = Integer.parseInt(s1.substring(1));
                switch (c) {
                    case 'W':
                        y += number;
                        break;
                    case 'D':
                        x += number;
                        break;
                    case 'A':
                        x -= number;
                        break;
                    case 'S':
                        y -= number;
                        break;
                    default:
                        break;
                }
            }
            System.out.println(x + ","+y);
        }
    }

}
